//
//  XCNightTableViewCell.m
//  SoundOfNature
//
//  Created by 梁新昌 on 16/3/10.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCNightTableViewCell.h"

@implementation XCNightTableViewCell
- (void)dealloc
{
    [_nightImageView release];
    [_nightLable release];
    [_switchBar release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.nightImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.nightLable = [[UILabel alloc] initWithFrame:CGRectZero];
        self.switchBar = [[UISwitch alloc] initWithFrame:CGRectZero];
        
        [self.contentView addSubview:self.switchBar];
        [self.contentView addSubview:self.nightImageView];
        [self.contentView addSubview:self.nightLable];
        
        [self.nightLable release];
        [self.nightImageView release];
        [self.switchBar release];
    }
    return self;
}

- (void)awakeFromNib {
   
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.nightImageView.frame = CGRectMake(18, 30, 20, 20);
    self.nightLable.frame = CGRectMake(self.nightImageView.bounds.size.width + 35, 30, self.bounds.size.width / 4, 20);
    self.switchBar.frame = CGRectMake(self.nightLable.bounds.size.width + 75, 30, 30, 30);
    self.nightLable.text = @"夜间模式";
    self.nightLable.font = [UIFont systemFontOfSize:13];
    self.nightImageView.image = [[UIImage imageNamed:@"Image-night"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
